<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>ajax-jquery</title>
    <script src="./js/jquery-1.12.4.min.js"></script>
    <script>
      window.onload = function () {
        var oBtn = document.querySelector("button");
        oBtn.onclick = function () {
          $.ajax({
            type: "GET",
            url: "08-ajax-jquery.php",
            data: "userName=lmx&userPwd=123456",
            success: function (msg) {
              alert(msg);
            },
            error: function (xhr) {
              alert(xhr.status);
            },
          });
        };
      };
    </script>
  </head>
  <body>
    <button>发送请求</button>
  </body>
</html>
